package lmf;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class AlbumLFM {

	public String name;
	public String playcount;
	public String mbid;
	public String last_fm_url;
	public String image_small;
	public String image_medium;
	public String image_large;
	public String image_extralarge;
	public String image_mega;

	public AlbumLFM(Node node) {
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element element = (Element) node;
			try {
				name = element.getElementsByTagName("name").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				playcount = element.getElementsByTagName("playcount").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				mbid = element.getElementsByTagName("mbid").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				last_fm_url = element.getElementsByTagName("url").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
			image_small = element.getElementsByTagName("image").item(0)
					.getFirstChild().getNodeValue();
			image_medium = element.getElementsByTagName("image").item(1)
					.getFirstChild().getNodeValue();
			image_large = element.getElementsByTagName("image").item(2)
					.getFirstChild().getNodeValue();
			image_extralarge = element.getElementsByTagName("image").item(3)
					.getFirstChild().getNodeValue();
			image_mega = element.getElementsByTagName("image").item(4)
					.getFirstChild().getNodeValue();
			}
			catch (Exception e) {
				// TODO: handle exception
			}
		}
	}
	
	public AlbumLFM(Document element) {
			try {
				name = element.getElementsByTagName("name").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				playcount = element.getElementsByTagName("playcount").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				mbid = element.getElementsByTagName("mbid").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
				last_fm_url = element.getElementsByTagName("url").item(0)
						.getFirstChild().getNodeValue();
			} catch (Exception e) {
				// TODO: handle exception
			}
			try {
			image_small = element.getElementsByTagName("image").item(0)
					.getFirstChild().getNodeValue();
			image_medium = element.getElementsByTagName("image").item(1)
					.getFirstChild().getNodeValue();
			image_large = element.getElementsByTagName("image").item(2)
					.getFirstChild().getNodeValue();
			image_extralarge = element.getElementsByTagName("image").item(3)
					.getFirstChild().getNodeValue();
			image_mega = element.getElementsByTagName("image").item(4)
					.getFirstChild().getNodeValue();
			}
			catch (Exception e) {
				// TODO: handle exception
			}
		}

}
